home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
com2asm2.lqr
/
COM2ASM2.DOC
< prev
Wrap
Text File
|
1985-06-13
|
2KB
|
66 lines
A
** PRESS YOUR ENTER KEY TO BEGIN **
For DOS 2.0
I use this program whenever I want to convert a
COM file to assembler source code, for subsequent
modification and re-assembly. Here's how it works:
Get into debug with the COM file you're working
with, and locate the areas containing the code.
(stay away from the data areas) Write down the
starting and ending addresses for all the code
areas in the file, and quit.
Back in dos, create a file to be piped into the
standard input of the debug program, containing
the commands necessary to unassemble the program
in the sequence in which it resides in ram.
The easiest way to do this is to use the copy
command.
A>copy con file1
u addr1 addr2 <-- unassemble the file
u addr3 addr4
. (etc.)
.
q <-- DON'T FORGET THIS!
^Z
1 File(s) copied
A>
Now, type
DEBUG (filename).COM <FILE1 >FILE2
This will (given enough time) generate a file
called FILE2 containing the result of the
above commands to debug. Now, run the
COM2ASM.BAS program, enter FILE2 in response
to the "Input file?" prompt, and some other
(new) file name for the output file prompt.
The program will then read file2, get rid of the
hex addresses on the left and the op code,
label the intra-segment jumps and calls and their
destinations with labels of the form "Ln",
where 0<n<999, and send the results to the other
(new) file. The result is compatible (as far as
it goes) with the IBM assembler.
If you get "Error: Referenced code not found",
it means that a jump or call was found which
referenced an address not found in the input file.
At this point, processing stops and the address of
the missing code is printed out, followed by
the addresses of referenced code not yet
processed.
When this happens, it either means you missed
portions of the code, you got 'unsynchronized'
during the unassembly (perhaps you started
unassembling in the middle of an instruction),
you got into data areas, or (possibly) the code
modifies itself during execution.
Rich Winkel
Columbia, Mo.
65399 '** DONE - PRESS ENTER TO RETURN TO MENU **